package CrashTesty;
import net.contentobjects.jnotify.JNotify;
import net.contentobjects.jnotify.JNotifyException;
import net.contentobjects.jnotify.JNotifyListener;

public class jnotify1 
{
    public static void main(String [] args) throws JNotifyException
    {
        String path = "C:/Users/Miki/Desktop";
        int mask =  JNotify.FILE_CREATED | 
        JNotify.FILE_DELETED | 
        JNotify.FILE_MODIFIED| 
        JNotify.FILE_RENAMED;

        boolean watchSubtree = true;
        int watchID = JNotify.addWatch(path, mask, watchSubtree, new JNotifyListener()
        {
            @Override
            public void fileCreated(int arg0, String folder_path, String file_name) 
            {
                //System.out.println("1");
            	System.out.println("created " + folder_path + " : " + file_name);
            }

            @Override
            public void fileDeleted(int arg0, String folder_path, String file_name) 
            {
                //System.out.println("2");
            	System.out.println("deleted " + folder_path + " : " + file_name);
            }

            @Override
            public void fileModified(int arg0, String folder_path, String file_name) 
            {
                //System.out.println("3");
            	System.out.println("modified " + folder_path + " : " + file_name);
            }

            @Override
            public void fileRenamed(int arg0, String folder_path, String file_name,
                    String arg3) 
            {
 
                //System.out.println("4");
            	System.out.println("renamed " + folder_path + " : " + file_name);
            }});
        try
        {
        		while(true)
        		{
        			Thread.sleep(1000000);
        		}
        }
        catch (InterruptedException e1)
        {
        }
    }
}